package dominio;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

public class OtroListCellRenderer extends DefaultListCellRenderer {
	int tipo;
	public OtroListCellRenderer(int i){
		this.tipo=i;
	}
	protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();

	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean hasFocus) {
		JLabel renderer = null;
		if(tipo==0){
		 renderer = (JLabel) defaultRenderer
				.getListCellRendererComponent(list, value, index, isSelected,
						hasFocus);
		
		renderer.setIcon(new ImageIcon(OtroListCellRenderer.class
				.getResource("/recursos/nada.png")));
		renderer.setHorizontalAlignment(JLabel.LEFT);
		renderer.setBackground(new Color(250, 250, 200));
		renderer.setForeground(Color.BLUE);
		renderer.setFont(new Font("Tahoma", Font.PLAIN, 16));
		if (isSelected)
			renderer.setBackground(new Color(200, 250, 200));
		}else if(tipo==1){
			renderer = (JLabel) defaultRenderer
					.getListCellRendererComponent(list, value, index, isSelected,
							hasFocus);
			renderer.setHorizontalAlignment(JLabel.LEFT);
			renderer.setBackground(new Color(250, 250, 200));
			renderer.setForeground(Color.BLUE);
			renderer.setFont(new Font("Tahoma", Font.PLAIN, 16));
			if (isSelected)
				renderer.setBackground(new Color(200, 250, 200));
		}
		return renderer;
	}
}